<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Java详细查找</title>
<!--[if lt IE 9]>
  <script src="libs/html5shiv.min.js"></script>
  <script src="libs/respond.min.js"></script>
  <![endif]-->
<script src="libs/jquery-1.12.1.min.js"></script>
<script type="text/javascript" src="libs/handlebars.min.js"></script>
<script type="text/javascript" src="libs/getQueryString.js"></script>
<link href="libs/bootstrap-3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script src="libs/bootstrap-3.3.6/js/bootstrap.min.js"></script>
<link href="libs/dropzone.css" rel="stylesheet" />
<script src="libs/dropzone.js"></script>
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="page-header">
				<h2>
					<strong>档案管理</strong>
				</h2>
			</div>
			<div class="col-md-8">
				<ul class="nav nav-pills">
					<li class=""><a href="index.html">首页</a></li>
					<li class=""><a href="add.html">添加</a></li>
					<li class=""><a href="mohuquery.html">查询</a></li>
				</ul>
				<!--nav-tabs -->
				<ul class="nav nav-tabs">
					<li role="presentation" class="active"><a href="#home"
						aria-controls="home" role="tab" data-toggle="tab">档案信息</a></li>
					<li role="presentation"><a href="#profile"
						aria-controls="profile" role="tab" data-toggle="tab">图片</a></li>
					<li role="presentation"><a href="#messages"
						aria-controls="messages" role="tab" data-toggle="tab">上传图片</a></li>
				</ul>
				<!--  -->
				<div class="tab-content" style="text-align: center;">
					<div role="tabpanel" class="tab-pane active" id="home">
						<div class="panel-body" id="list1">
							<div class="container">
								<div class="row">
									<div class="col-md-12">
										<div class="panel panel-primary">
											<div class="panel-heading">
												<h4>详细信息</h4>
											</div>
											<div style="text-align: center;">
												<table border="2">
													<tr>
														<td>ID</td>
														<td><input id="id" readonly="readonly"></td>
													</tr>
													<tr>
														<td>檔案號</td>
														<td><input id="archive_id" readonly="readonly"></td>
													</tr>
													<tr>
														<td>身份证号</td>
														<td><input id="identity"></td>
													</tr>
													<tr>
														<td>姓名</td>
														<td><input id="name"></td>
													</tr>
													<tr>
														<td>性别</td>
														<td><input id="gender"></td>
													</tr>
													<tr>
														<td>出生日期</td>
														<td><input id="birthday"></td>
													</tr>
													<tr>
														<td>预退休日期</td>
														<td><input id="date_retire1"></td>
													</tr>
													<tr>
														<td>实际退休日期</td>
														<td><input id="date_retire2"></td>
													</tr>
													<tr>
														<td>特殊工种</td>
														<td><input id="sp"></td>
													</tr>
													<tr>
														<td>女管理岗位</td>
														<td><input id="fc"></td>
													</tr>
													<tr>
														<td>职称</td>
														<td><input id="title"></td>
													</tr>
													<tr>
														<td>工龄</td>
														<td><input id="seniority"></td>
													</tr>
													<tr>
														<td colspan="2"><input type="button" id="update"
															value="修改"></td>
													</tr>
												</table>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div role="tabpanel" class="tab-pane" id="profile">
						<div class="row" id="profile1"></div>
					</div>
					<div role="tabpanel" class="tab-pane" id="messages">
						<!-- 	    <form action="" method="post" enctype="multipart/form-data" id="form">
	       <input type="file" name="file" />
	       <button type="submit">上传</button> -->
						<form id="dropzone" action="" class="dropzone" method="post"></form>
						</form>
					</div>
				</div>
			</div>
			<div class="col-md-3 col-md-offset-1">
				<ul class="nav nav-pills">
					<li><a href="#">用户：<span id="account"></span></a></li>
					<li class=""><a href="register.html">注册</a></li>
					<li><button id="quit" class="btn btn-block">退出</button></li>
				</ul>
			</div>
		</div>
	</div>
	<script id="template" type="text/x-handlebars-template">
    {{#each item}}
 	 <div class="panel panel-default col-md-4" >
   	  <div class="panel-body">
	   <a href="deltp.html?id={{id}}">	
       <img src="upload/{{archive_id}}/{{name}}" width="200" height="200" />
                    删除
       </a>
      </div>
   	 </div>
 	{{/each}}
</script>
</body>
<script type="text/javascript">
	$('#myTabs a').click(function(e) {
		e.preventDefault()
		$(this).tab('show')
	})
</script>
<script type="text/javascript">
	$(function() {
		$.getJSON('querynickname.action', function(res) {
			console.log(res);
			$('#account').text(res.nickname);
		});
		var id = getQueryString('id');
		var url = 'one.action?id=' + id;
		//	$('#form').attr('action', id + '/upload.action');
		$.getJSON(url, function(res) {
			console.log(res);
			$('#id').val(res.id);
			$('#archive_id').val(res.archive_id);
			$('#identity').val(res.identity);
			$('#name').val(res.name);
			$('#gender').val(res.gender);
			$('#birthday').val(res.birthday);
			$('#date_retire1').val(res.date_retire1);
			$('#date_retire2').val(res.date_retire2);
			$('#sp').val(res.sp);
			$('#fc').val(res.fc);
			$('#title').val(res.title);
			$('#seniority').val(res.seniority);
		});
		$('#quit').click(function() {
			$.post('quit.action', {}, function(res, status) {
				if ('OK' == res) {
					alert('退出成功');
					window.location.href = 'login.html';
				}
			});
		});
		$('#update').click(function() {
			$.post('update.action?id=' + id, {
				//id:$('#id').val(),
				archive_id : $('#archive_id').val(),
				identity : $('#identity').val(),
				name : $('#name').val(),
				gender : $('#gender').val(),
				birthday : $('#birthday').val(),
				date_retire1 : $('#date_retire1').val(),
				date_retire2 : $('#date_retire2').val(),
				sp : $('#sp').val(),
				fc : $('#fc').val(),
				title : $('#title').val(),
				seniority : $('#seniority').val()
			}, function(res, status) {
				if ("OK" == res) {
					alert('修改成功');
				}
			});
		});
	});
	$(function() {
		var id = getQueryString('id');
		$.getJSON('queryfile.action?id=' + id, function(res) {
			console.log(res);
			var data = {
				'item' : res
			};
			var t = Handlebars.compile($('#template').html());
			$('#profile1').html(t(data));
		});
	});
</script>
<script type="text/javascript">
	var id = getQueryString('id');
	Dropzone.options.dropzone = {
		url : id + '/upload.action',
		clickable : true,
		acceptedFiles : '.jpg',
		dictDefaultMessage : '拖放图片文件到此位置',
		dictInvalidFileType : '错误的文件类型',
		dictFileTooBig : '文件过大',
		dictResponseError : '与服务器连接失败',
		dictCancelUpload : '已取消',
		dictCanceluploadConfirmation : '确认取消上传'
	}
</script>

</html>